<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<title></title>
	<script src='js/vue.js'></script>
</head>

<body>
	<div id="app">
		{{a}}
	</div>
	<script>
		//生命周期函数就是vue实例在某一个时间点会自动执行的函数
		var vm = new Vue({
			el: "#app",
			data: {
				a: 2
			},
			beforeCreate: function () {
				console.log('beforeCreate');
			},

			created: function () {
				console.log('created');
				console.log(this.a);
				console.log(this.$el);
			},
			beforemounted: function () {
				console.log('beforemounted');
				console.log(this.$el);
			},

			mounted: function () {
				console.log('mounted');
				console.log(this.$el);
			},
			beforeDestroy: function () {
				console.log('beforeDestroy');
				console.log(this.$el);
			},
			destroyed: function () {
				console.log('destroyed');
				console.log(this.$el);
			},
		});
	</script>

</body>

</html>